<template>
    <div>
        <el-table :data="secklist" border style="width: 100%">
            <el-table-column prop="title" label="活动名称" width="180">
            </el-table-column>
            <el-table-column label="状态" width="180">
                <template slot-scope="item">
                    <div>
                        <el-button v-if="item.row.status == 1" type="success" size="small">启用</el-button>
                        <el-button v-else type="danger" size="small">禁用</el-button>
                    </div>
                </template>
            </el-table-column>
            <el-table-column label="操作">
                <template slot-scope="item">
                    <div>
                        <el-button type="primary" icon="el-icon-edit" circle @click="edit(item.row.id)"></el-button>
                        <el-button type="danger" icon="el-icon-delete" circle @click="del(item.row.id)"></el-button>
                    </div>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>
<script>
import {seckDelete} from '../../request/api'
import { mapGetters, mapActions } from 'vuex'
export default {
    data() {
        return {

        }
    },
    methods: {
        edit(id){
            this.$emit('edit',id)
        },
        ...mapActions({
            getSeck:'seck/getSevkListAction'
        }),
        //删除
        del(id){
           this.$confirm('你确定要删除吗？','提示',{
            confirmButtonText:'确定',
            cancelButtonText:'取消',
            type:'warning'
           }).then(()=>{
            seckDelete({id}).then(res=>{
                if(res.code==200){
                    this.getSeck()
                    this.$message.success(res.msg)
                }
            })
           }).catch(()=>{
            this.$message({
                type:'info',
                message:'已取消'
            })
           })
        }
    },
    mounted() { 
        this.getSeck()
    },
    watch: {},
    computed: {
        ...mapGetters({
            secklist: 'seck/getSevkList'
        })
    },
    filters: {},
    components: {}
}
</script>
<style scoped></style>